package com.demo.gaoxiao.controller;


import com.demo.gaoxiao.service.IJiaoshiService;
import com.demo.gaoxiao.service.IJiaoshixingzhengService;
import com.demo.gaoxiao.service.IShiyanyuanService;
import com.demo.gaoxiao.service.IXingzhengService;
import com.demo.gaoxiao.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 人员基础信息表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-06-06
 */
@Controller
@RequestMapping("/api/admin/users")
public class UsersController {

    @Autowired
    private IJiaoshiService jiaoshiService;

    @Autowired
    private IShiyanyuanService shiyanyuanService;

    @Autowired
    private IXingzhengService xingzhengService;

    @Autowired
    private IJiaoshixingzhengService jiaoshixingzhengService;

    /**
     * 进入管理页面
     * @return
     */
    @RequestMapping("/index")
    public String index(){
        return "/view/admin/tongji/tongji";
    }

    /**
     * 统计
     * @return
     */
    @RequestMapping("/getCount")
    @ResponseBody
    public Result getCount(){
        Map<String,Object> objectMap=new HashMap<>();
        objectMap.put("jiaoshiCount",jiaoshiService.list().size());
        objectMap.put("shiyanCount",shiyanyuanService.list().size());
        objectMap.put("xingzhengCount",xingzhengService.list().size());
        objectMap.put("jiaoshixingzhengCount",jiaoshixingzhengService.list().size());
        return Result.reOk("查询成功",objectMap);
    }




}
